{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "data = {\n",
    "    \"width\": 512, \"height\": 512, \"video_frames\": 25, \"motion_bucket_id\": 100, \"fps\": 8, # 条件\n",
    "    \"seed\": None, \"steps\": 20, \"cfg\": 2.0, #采样\n",
    "    \"save_fps\": 8, # 保存\n",
    "}\n",
    "files = {\"file\": open(\"input/test.png\", \"rb\")}\n",
    "response = requests.post(\"http://127.0.0.1:8182/img2vid\", files=files, data=data)\n",
    "with open(\"output/test.webp\", \"wb\") as f:\n",
    "    f.write(response.content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "json = {\"prompt\": \"a cute boy\", \"style\": \"Clay\", \"seed\": None, \"num\": 1}\n",
    "response = requests.post(\"http://127.0.0.1:8183/text2img_lora\", json=json)\n",
    "with open(\"output/test.png\", \"wb\") as f:\n",
    "    f.write(response.content)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "diffusion",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
